<template>
	<view class="container">
		<view class="container2">
			<view class="header">
				信息确认页面
			</view>
			<view class="datail">
				<view class="item">
					请您仔细检查孩子的信息，一旦缴费，不可修改，如有问题请咨询老师
					☆☆☆请仔细检查电话号码☆☆☆
				</view>
				<view class="item">
					<view class="title">
						<view class="col">

						</view>
						学生姓名：
					</view>
					<view class="info" v-text="info.studentName">

					</view>
				</view>
				<view class="item">
					<view class="title">
						<view class="col">

						</view>
						应上年级：
					</view>
					<view class="info" v-text="info.grade">

					</view>
				</view>
				<view class="item">
					<view class="title">
						<view class="col">

						</view>
						家长姓名：
					</view>
					<view class="info" v-text="info.parentName">

					</view>
				</view>
				<view class="item">
					<view class="title">
						<view class="col">

						</view>
						联系电话：
					</view>
					<view class="info" v-text="info.phoneNumber">

					</view>
				</view>
				<view class="item">
					<view class="title">
						<view class="col">

						</view>
						家庭住址：
					</view>
					<view class="info" v-text="info.address">

					</view>
				</view>
				<view class="item">
					<view class="title">
						<view class="col">

						</view>
						备注：
					</view>
					<view class="info" v-text="info.question">

					</view>
				</view>

			</view>

			<view class="controller">
				<button @click="back">返回修改</button>
				<button @click="submit" style="background-color: skyblue;">报名</button>
			</view>
		</view>
	</view>
</template>
<script>
	import {
		globalVariable
	} from '../../configMy.js';
	export default {
		data() {
			return {
				info: {
					grade: "请选择年级",
					studentName: "",
					address: "",
					parentName: "",
					phoneNumber: "",
					question: ""
				}
			};
		},
		onLoad(e) {
			let info = JSON.parse(decodeURIComponent(e.infostudent))
			this.info = info;
		},
		methods: {
			back() {
				uni.navigateBack({
					delta: 1
				});
			},
			submit() {
				let that = this;
				uni.showModal({
					title: '提示请仔细检查信息',
					content: '确认信息无误',
					success: function(res) {
						if (res.confirm) {
							let stu = that.info;
							uni.request({
								url: globalVariable+"/addStudentAdmin?stuname=" + stu
									.studentName +
									"&parentname=" + stu.parentName +
									"&grade=" + stu.grade +
									"&address=" + stu.address +
									"&phoneNumber=" + stu.phoneNumber +
									"&question=" + stu.question +
									"&promoCode=" + "" +
									"&openId=" + "123456",
								success(res) {
									let info = res.data;
									uni.showToast({
										title: info.message,
										//将值设置为 success 或者直接不用写icon这个参数
										icon: info.status ==1?'success':'fail',
										//显示持续时间为 2秒
										duration: 2000
									});
								},
								fail() {
									uni.showToast({
										title: '服务器错误，报名失败！',
										//将值设置为 success 或者直接不用写icon这个参数
										icon: 'fail',
										//显示持续时间为 2秒
										duration: 2000
									})
									console.log("添加失败");
								}
							})
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});


			}
		},
	};
</script>
<style scoped>
	.container .item {
		width: 90%;
		height: 100rpx;
		display: flex;
		justify-content: left;
		align-items: center;
		font-size: 23px;
		padding: 20rpx;
		margin-bottom: 30rpx;
		/* border-bottom-style: groove; */
		margin-bottom: 15rpx;
	}

	.datail .item:nth-child(1) {
		font-size: 20px;
		border-bottom-style: groove;
		color: #ff5c67;
		height: 200rpx;
	}

	.datail .item:nth-child(7) {
		align-items: initial;

	}

	.datail .item:nth-child(7) .info {
		overflow: auto;
	}

	.container .item .info {
		width: 60%;
	}

	page {
		background-color: #c4dfff;
	}

	.container2 .datail {
		background-color: #ffffff;
		padding-bottom: 50rpx;
	}

	.controller {
		margin-top: 100rpx;
		display: flex;
	}


	.controller button {
		width: 40%;
		background-color: #ffa7a9;
		margin-bottom: 50rpx;
	}

	.controller button:active {
		background-color: #ff5762;
	}

	.texta {
		display: flex;
		justify-content: center;
	}

	.texta textarea {
		width: 90%;
		background-color: #ffffff;
		height: 200rpx;
		border-style: groove;
		border-radius: 10rpx;
		text-indent: 10rpx;
		font-size: 20px;
	}

	.container2 {
		width: 90%;
		/* background-color: white; */
		height: 90%;
		border-radius: 10rpx;
		margin-top: 10rpx;
	}

	.container .header {
		height: 100rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		font-size: 30px;
		background-color: #ff8e8ee0;
	}

	.container {
		width: 100%;
		/* background-image: url("/static/background1.jpg"); */
		/* padding: 20rpx; */
		background-color: #c4dfff;
		display: flex;
		justify-content: center;
		align-items: center;
		height: 100%;
	}


	.container .item .title {
		width: 45%;
		display: flex;
		align-items: center;
		height: 100%;
	}

	.container .item .title .col {
		width: 30rpx;
		height: 50rpx;
		background-color: rgb(7, 150, 227);
		border-radius: 10rpx;
		margin-right: 10rpx;
	}
</style>